package org.skyer.third.gateway.api.feign;

import io.swagger.annotations.ApiOperation;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.skyer.third.gateway.api.dto.*;
import org.skyer.third.gateway.api.vo.BaseReceiverInfoVO;
import org.skyer.third.gateway.api.vo.QueryOrderByAddressVO;

import javax.validation.Valid;
import java.util.List;



@FeignClient(
        value = IOrderBackFlowClient.APP_NAME
)
public interface IOrderBackFlowClient {

    String APP_NAME = "skyer-third-gateway";

    String API_PREFIX = "/client";

    String ORDER_BACK_FLOW = API_PREFIX + "/orderBackFlow";

    String ORDER_UPDATE_REMARKS = API_PREFIX + "/updateRemarks";

    String ORDER_UPDATE_ADDRESS = API_PREFIX + "/updateAddress";

    String ORDER_DECRYPT = API_PREFIX + "/decryptOrderReceiverInfo";

    String QUERY_ORDER_BY_ADDRESS = API_PREFIX + "/queryOrderByAddress";

    /**
     * 执行订单回流
     *
     * @param request 业务参数
     * @return 结果
     */
    @ApiOperation(value = "执行订单回流")
    @PostMapping(ORDER_BACK_FLOW)
    R<BackFlowResultDTO<?>> execute(@Valid @RequestBody OrderBackFlowRequestDTO request);

    /**
     * 订单修改备注
     * @param ecRemarkUploadDTO
     * @return
     */
    @ApiOperation(value = "订单修改备注")
    @PostMapping(ORDER_UPDATE_REMARKS)
    R updateRemarks(@RequestBody EcRemarkUploadDTO ecRemarkUploadDTO);

    /**
     * 订单修改地址
     * @param orderReceiverInfoDTO
     * @return
     */
    @ApiOperation(value = "订单修改地址")
    @PostMapping(ORDER_UPDATE_ADDRESS)
    R updateAddress(@RequestBody OrderReceiverInfoDTO orderReceiverInfoDTO);

    /**
     * 订单解密
     * @param commonReceiverInfoDecryptDTO
     * @return
     */
    @ApiOperation(value = "订单解密")
    @PostMapping(ORDER_DECRYPT)
    R<BaseReceiverInfoVO> decryptOrderReceiverInfo(@RequestBody ReceiverInfoDecryptDTO commonReceiverInfoDecryptDTO);


    /**
     * 订单检索
     * @param dto
     * @return
     */
    @ApiOperation(value = "订单检索")
    @PostMapping(QUERY_ORDER_BY_ADDRESS)
    R<List<QueryOrderByAddressVO>> queryOrderByAddress(@RequestBody List<QueryOrderByAddressDTO> dto);
}
